<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
  <title>增加投票</title>
	<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
	<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  <link rel="stylesheet" href="../static/web/css/admin.css">
  <link rel="stylesheet" href="../static/web/css/daterangepicker.css">
  <script language="javascript" src="../static/web/js/jquery.min.js"></script>
	<script language="javascript" src="../static/web/js/bootstrap.bundle.min.js"></script>
  <script language="javascript" src="js/main.js"></script>
  <script type="text/javascript" src="../static/web/js/moment.min.js"></script>
  <script type="text/javascript" src="../static/web/js/daterangepicker.js"></script>
  <script language="javascript">
    var i = 1;
    function AddItem() {
      i++;
      if (i > 15) {
        ShowMsg("最大只允许15个选项");
        return;
      }
      var htmldata = "<br>选项" + i + "：<input name='voteitem" + i + "' type='text' size='30' class='mt-2'>";
      jQuery("#voteitem").append(htmldata);
    }
    function ResetItem() {
      i = 1;
      var obj = document.getElementById("voteitem");
      obj.innerHTML = "选项1：<input name='voteitem1' type='text' size='30'>";
    }
    function checkSubmit() {
      if (document.form1.votename.value == "") {
        ShowMsg("投票名称不能为空");
        document.form1.votename.focus();
        return false;
      }
    }
  </script>
<script language="javascript">
  $(document).ready(function () {
    $('.datepicker1').daterangepicker({
      "singleDatePicker": true,
      "autoApply": true,
      "showDropdowns": true,
      "linkedCalendars": false,
      "timePicker": true,
      "timePicker24Hour": true,
      //"timePickerSeconds": true,
      "showCustomRangeLabel": false,
      ranges: {
        '今日': [moment(), moment()],
        '昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
        '本月': [moment().startOf('month'), moment().startOf('month')],
        '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').startOf('month')]
      },
      "locale": {
        format: 'YYYY-MM-DD HH:mm',
        applyLabel: '确定',
        cancelLabel: '取消',
        daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
        monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
          '七月', '八月', '九月', '十月', '十一月', '十二月'],
        firstDay: 1
      }
    }, function (start) {
      $(this).val(start.format("YYYY-MM-DD HH:mm"));
    });
  })
</script>
</head>
<body>
  <table width="98%" cellpadding="3" cellspacing="1" align="center" class="table maintable mt-3 mb-3">
    <tr>
      <td height="26" background="../static/web/img/tbg.gif" style="padding-left:10px"><a href='vote_main.php'>投票管理</a> &gt; 增加投票</td>
    </tr>
    <tr>
      <td height="200">
        <table width="100%" cellspacing="4" cellpadding="4" class="table table-borderless">
          <form name="form1" method="post" action="vote_add.php" onSubmit="return checkSubmit()">
            <input type='hidden' name='dopost' value='save'>
            <input type="hidden" name="isarc" value="<?php echo $isarc; ?>">
            <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
            <tr>
              <td width="260" height="26">投票名称：</td>
              <td height="26"><input name="votename" type="text" id="votename" style="width:260px"></td>
            </tr>
            <tr>
              <td height="26">开始时间：</td>
              <td height="26"><input name="starttime" type="text" id="starttime" value="<?php echo $startDay?>" class="dateico datepicker1" style="width:260px"></td>
            </tr>
            <tr>
              <td height="26">结束时间：</td>
              <td height="26"><input name="endtime" type="text" id="endtime" value="<?php echo $endDay?>" class="dateico datepicker1" style="width:260px"></td>
            </tr>
            <tr>
              <td height="26">是否允许游客投票：</td>
              <td height="26"> 
                <label><input name="isallow" type="radio" class="np" value="0">
                是</label>
                <label><input type="radio" name="isallow" class="np" value="1" checked>
                否</label>
              </td>
            </tr>
            <tr>
              <td height="26">是否允许查看投票：</td>
              <td height="26"> 
                <label><input name="view" type="radio" class="np" value="0">
                是</label>
                <label><input type="radio" name="view" class="np" value="1" checked>
                否</label>
              </td>
            </tr>
            <tr>
              <td height="26">投票时间间隔：</td>
              <td height="26"><input name="spec" type="text" value="" class="spec" style="width:260px">（N天后可再次投票，0 表示此IP地址只能投一次）</td>
            </tr>
            <tr>
              <td height="26">是否多选：</td>
              <td height="26"> 
                <label><input name="ismore" type="radio" class="np" value="0" checked>
                单选</label>
                <label><input type="radio" name="ismore" class="np" value="1">
                多选</label>
              </td>
            </tr>
            <tr>
              <td height="26">投票项：</td>
              <td height="26">
                <button type="button" name="bbb" class="btn btn-success btn-sm" onClick="AddItem();">增加投票选项</button>
                <button type="button" name="bbb2" class="btn btn-success btn-sm" onClick="ResetItem();">重置投票选项</button>
              </td>
            </tr>
            <tr>
              <td height="26"></td>
              <td height="26">
                <div id="voteitem">
                  选项1：<input name="voteitem1" type="text" size="30" id="voteitem1">
                </div>
              </td>
            </tr>
            <tr>
              <td height="26">是否启用：</td>
              <td height="26"> 
                <label><input name="isenable" type="radio" class="np" value="0" checked>
                是</label>
                <label><input type="radio" name="isenable" class="np" value="1">
                否</label>
              </td>
            </tr>
            <tr>
              <td colspan="2" align="center" class="py-3">
                <button type="submit" name="Submit" class="btn btn-success btn-sm">保存</button>
                <button type="button" onclick="history.back()" name="Submit" class="btn btn-success btn-sm">返回</button>
              </td>
            </tr>
          </form>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>